package com.zg;

import com.zg.service.MqttBrokerService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;
import java.net.InetSocketAddress;


@SpringBootApplication
public class MqttServerApplication implements ApplicationRunner {

    @Resource
    private MqttBrokerService mqttBrokerService;

    public static void main(String[] args) {
        SpringApplication.run(MqttServerApplication.class,args);
    }

    /*@PostConstruct
    public void startService(){
        mqttBrokerService.start(new InetSocketAddress(1883));
    }*/

    @Override
    public void run(ApplicationArguments args) throws Exception {
        mqttBrokerService.start(new InetSocketAddress(1883));
    }
}
